package com.cd.javacxy.common.converter;

import cn.hutool.core.util.StrUtil;
import com.cd.javacxy.common.model.enums.SolveEnum;
import org.springframework.core.convert.converter.Converter;


/**
 * @author cookie
 */
public class StringToSolveTypeConverter implements Converter<String, SolveEnum> {

    @Override
    public SolveEnum convert(String source) {
        if (StrUtil.isEmpty(source)) {
            return null;
        }
        return SolveEnum.getSolveEnumByType(Integer.parseInt(source));
    }

}
